package com.haitai.solr.resp;

/**
 * 分页工具对象
 * 
 * @author jingbiaoCai
 * @version 0.1 cjb 2012-04-10 添加内容,未实现快捷页码转向功能的初使�?
 * 
 */
public class Pager {

    // 当前页
    private int currentPage;
    // 总页页
    private int totalPage;
    // 总记录数
    private int totalRecords;
    // 每页记录数
    private int pageSize;
    // 数据
    private Object data;

    public Pager() {

    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    /**
     * 
     * @param pageSize
     *            每页记录数
     * @param totalRecords
     *            总记录数
     * @param currentPage
     *            当前页
     */
    public Pager(int pageSize, int totalRecords, int currentPage) {
        this.pageSize = pageSize;
        this.totalRecords = totalRecords;
        this.currentPage = 1;
        this.currentPage = currentPage;
        this.totalPage = totalRecords % pageSize == 0 ? (int) (totalRecords / pageSize) : (int) (totalRecords / pageSize) + 1;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getTotalRecords() {
        return totalRecords;
    }

    public void setTotalRecords(int totalRecords) {
        this.totalRecords = totalRecords;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

}
